local tuiyan = fk.CreateSkill {
  name = "lingling__tuiyan",
}

Fk:loadTranslationTable{
  ["lingling__tuiyan"] = "推演",
  [":lingling__tuiyan"] = "出牌阶段限一次，你可以亮出牌堆底的牌，然后若你能使用此牌则使用并重复此流程（每回合至多使用四次）。",

  ["#lingling__tuiyan"] = "推演：亮出牌堆底的牌并使用之",
  ["#lingling__tuiyan-use"] = "推演：请使用%arg",
}

tuiyan:addEffect("active", {
  anim_type = "offensive",
  prompt = "#lingling__tuiyan",
  card_filter = Util.FalseFunc,
  target_filter = Util.FalseFunc,
  can_use = function (self, player)
    return player:usedSkillTimes(tuiyan.name, Player.HistoryPhase) == 0
  end,
  on_use = function (self, room, effect)
    local player = effect.from
    for _ = 1, 4 do
      if player.dead then return end
      local card = room:getNCards(1, "bottom")
      room:turnOverCardsFromDrawPile(player, card, tuiyan.name, true)
      local use = room:askToUseRealCard(player, {
        pattern = card,
        skill_name = tuiyan.name,
        prompt = "#lingling__tuiyan-use:::"..Fk:getCardById(card[1]):toLogString(),
        extra_data = {
          bypass_times = true,
          extraUse = true,
          expand_pile = card,
        },
        cancelable = false,
      })
      if use == nil then
        room:cleanProcessingArea(card)
        break
      end
    end
  end,
})

return tuiyan
